package com.zhong.gang.applib.ui;

import android.app.Activity;
import android.os.Handler;
import android.os.Message;
import android.view.View;

import androidx.annotation.NonNull;

import com.zhong.gang.applib.R;
import com.zhong.gang.applib.base.act.ActBase;
import com.zhong.gang.applib.databinding.ActivityLaunchBinding;


public abstract class BaseLaunchAct extends ActBase<ActivityLaunchBinding> {

    private Handler handler = new Handler(){
        @Override
        public void handleMessage(@NonNull Message msg) {
            super.handleMessage(msg);
            handler.removeCallbacksAndMessages(null);
            open();
        }
    };

    @Override
    public int LayoutRes() {
        return R.layout.activity_launch;
    }

    @NonNull
    @Override
    public String CreateTitle() {
        return null;
    }

    @Override
    public void initView() {
        getRoot().setBackgroundColor(getResources().getColor(R.color.transparent));
        getTitleBar().setVisibility(View.GONE);
        handler.sendEmptyMessageDelayed(1,2000);
    }

    public abstract void open();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        handler.removeCallbacksAndMessages(null);
    }
}
